/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufrgs.jsopa;

/**
 * This is a FIFO Scheduler. Timer interruption doesn't force a change in the
 * running process.
 *
 * @author fkrahe
 */
public class SchedulerFIFO extends Scheduler {

    public SchedulerFIFO(Disco disk) {
        super(disk);
    }

    @Override
    public void treatInterruption(int intNumber) {
        ProcessDescriptor aux;
        switch (intNumber) {
            case 2: // TIMER
                Main.print("CPU will keep running: " + readyList.getFront().getPID());
                break;
            case 5: // DISK HW INT
                aux = diskList.popFront();
                readyList.pushBack(aux);
                break;
            case 36: // GET SW INT
                aux = readyList.popFront();
                diskList.pushBack(aux);
                dis.roda();
                break;
            default:
                Main.print("Unknown...");
        }
        process = readyList.getFront();
    }
}
